<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>项目列表</title>
<jsp:include page="../../import.jsp" flush="true" />
<!-- 是否显示设置敞口按钮 -->
<sys:funcAuth resCd="LinkCrAmt">
	<span id="isShowLinkCrAmtBtn" />
</sys:funcAuth>
</head>
<body class="iframeBody">
<div class="Wrapper">
<div id="pageInTab" class="pageInTab">
<div tabid="tabA" title="项目列表" lselected="true">
<div class="fieldset1 tabel_col clearFix" id="splPrjPoTab" >
			<div class="caption">
				<span class="title">项目信息汇总</span>
			</div>
			<div class="fieldBox col_33">
				<div class="label">报单数</div>
				<div class="field">
					<span name="prjNum" id="prjNum">&nbsp;</span>
				</div>
			</div>
			<div class="fieldBox col_33">
				<div class="label">评审通过数</div>
				<div class="field">
					<span name="prjSucNum" id="prjSucNum">&nbsp;</span>
				</div>
			</div>
			<div class="fieldBox col_33">
				<div class="label">放款额</div>
				<div class="field">
					<span name="payAmt" id="payAmt">&nbsp;</span>
				</div>
			</div>
			<div class="fieldBox col_33">
				<div class="label">逾期率</div>
				<div class="field">
					<span name="ovdPct" id="ovdPct">&nbsp;</span>
				</div>
			</div>
</div>
<div class="searchArea">
    <form id="searchBar">
        <div class="fieldset1 clearFix">
            <div class="fieldBox" id="searchPrjNmId">
                <div class="label">项目名称</div>
                <div class="field">
                    <input name="prjNm" id="prjNm" type="text" class="ui-textbox" value="">
                </div>
            </div>
           <div class="fieldBox" id="searchCstNmId">
                <div class="label">客户名称</div>
                <div class="field">
                    <input name="cstNm" id="cstNm" type="text" class="ui-textbox" value="">
                </div>
            </div>
             <div class="fieldBox" id="searchCstNmId" isyw="0">
                <div class="label">客户经理名称</div>
                <div class="field">
                    <input name="cstMgrNm" id="cstMgrNm" type="text" class="ui-textbox" value="">
                </div>
            </div>
            <div class="fieldBox" id="searchCstNmId">
                <div class="label">员工号</div>
                <div class="field">
                    <input name="userNm" id="userNm" type="text" class="ui-textbox" value="">
                </div>
            </div>
             <div class="fieldBox" id="searchPrjTypCdId">
              <div class="label">项目类型</div>
                <div class="field">
                <select name="prjTypCd"  id="prjTypCd" >
                 <option value="  " selected="selected">--请选择--</option>
                 <c:forEach items="${projectTypeList}" var="opt">
                  <option value="${opt.key}">${opt.value}</option>
                 </c:forEach>
                </select>
                </div>
            </div>
            
           <div class="fieldBox" id="searchCntTypCdId">
            <div class="label">合同签署方式</div>
               <div class="field">
                 <select name="cntTypCd"  id="cntTypCd"  >
                  <option value="  " selected="selected">--请选择--</option>
                <c:forEach items="${cntTypCdList}" var="opt">
                 <option value="${opt.key}">${opt.value}</option>
                </c:forEach>
               </select>
               </div>
            </div>
         <div class="fieldBox" id="searchBizTypCdId">
            <div class="label">业务类型</div>
               <div class="field">
                 <select name="bizTypCd"  id="bizTypCd"  >
                  <option value="  " selected="selected">--请选择--</option>
                <c:forEach items="${bizTypeList}" var="opt">
                 <option value="${opt.key}">${opt.value}</option>
                </c:forEach>
               </select>
               </div>
            </div>
             <div class="fieldBox col_33" id="searchPrjStsCdId">
                   <div class="label">项目状态</div>
                             <div class="field">
                               <select name="prjStsCd"  id="prjStsCd" >
                                <option value="  " selected="selected">--请选择--</option>
                              <c:forEach items="${prjStsList}" var="opt">
                               <option value="${opt.key}">${opt.value}</option>
                              </c:forEach>
                             </select>
                             </div>
                   </div>
             <div class="fieldBox" id="searchLsCntNoId">
                <div class="label">合同号</div>
                <div class="field">
                    <input name="lsCntNo" id="lsCntNo" type="text" class="ui-textbox" value="">
                </div>
            </div>
                <div class="fieldBox" id="searchBuOrgCdId">
                <div class="label">所属事业部</div>
                <div class="field">
                    <select name="buOrgCd" id="buOrgCd">
                        <option value=" " seleted>请选择</option>
                        <c:forEach items="${orgListList }" var="org">
                        	<c:if test="${currentBuOrgCd == org.key }">
                        		<option value="${org.key }" selected>${org.value }</option>
                        	</c:if>
                        	<c:if test="${currentBuOrgCd != org.key }">
                        		<option value="${org.key }">${org.value }</option>
                        	</c:if>
                        </c:forEach>
                    </select>
                </div>
            </div>
            <div class="fieldBox col_33" id="searchInsCodeId" <sys:resourceAuth resCd="noThdOrg">style="display: none" </sys:resourceAuth>>
               <div class="label">第三方机构</div>
                 <div class="field">
                   <select name="insCode"  id="insCode" >
                    <option value="  " selected="selected">--请选择--</option>
                      <c:forEach items="${friBaseList}" var="fri">
                       <option value="${fri.insCode}">${fri.fundRasInsNmShow}</option>
                      </c:forEach>
                   </select>
                 </div>
            </div>
            <div class="fieldBox col_33" id="isDelId" >
                <div class="label">是否删除</div>
                <div class="field">
                    <select name="isDel"  id="isDel"  >
		                  <option value="0"  selected="selected">否</option>
		                 <option value="1">是</option>
	               </select>
                </div>
            </div>
             <div class="fieldBox col_33" id="cstMgrOrgCdId" >
                <div class="label">所属公司</div>
                <div class="field">
                    <input name="cstMgrOrgCd" id="cstMgrOrgCd" type="text" class="ui-textbox" value="">
                </div>
            </div>
            <!--  <div class="fieldBox">
                <div class="label">所属机构</div>
                <div class="field">
                    <input name="orgCd" id="orgCd" type="text" class="ui-textbox"  value=" "   placeholder="请选择"  ltype="combobox">
                </div>
            </div> -->
              <div class="fieldBox col_33" > 
                <div class="label">创建时间</div>
                <div class="field">
                     <input name="stDt" id="stDt" type="text" class="ui-datepicker" value="">
                     <span>---</span>
                      <input name="endDt" id="endDt" type="text" class="ui-datepicker" value="">
                </div>
            </div>
            <div class="fieldBox col_33" id="isSplMfrDiv" >
                <div class="label">是否厂商业务</div>
                <div class="field">
                    <select name="isSplMfr"  id="isSplMfr"  >
                        <option value="  "  selected="selected">-请选择-</option>
                        <option value="0" >否</option>
                        <option value="1">是</option>
                    </select>
                </div>
            </div>
            <div class="fieldBox col_33" id="isInsBizDiv" >
                <div class="label">是否资管业务</div>
                <div class="field">
                    <select name="isInsBiz"  id="isInsBiz"  >
                        <option value=" "  selected="selected">-请选择-</option>
                        <option value="0">否</option>
                        <option value="1">是</option>
                    </select>
                </div>
            </div>
            <div class="fieldBox col_33" id="compensatoryType">
                <div class="label">渠道担保业务类型</div>
                <div class="field">
                    <select name="compensatoryType"  id="compensatoryType" >
                        <option value="  " selected="selected">--请选择--</option>
                        <c:forEach items="${compensatoryTypeList}" var="opt">
                            <option value="${opt.key}">${opt.value}</option>
                        </c:forEach>
                    </select>
                </div>
            </div>
            <%--<div class="fieldBox" id="searchRegionCdId">
                <div class="label">所属区域</div>
                <div class="field">
                    <select name="cstMgrRgnCd"  id="cstMgrRgnCd"  >
                        <option value="  " selected="selected">--请选择--</option>
                        <c:forEach items="${regionList}" var="opt">
                            <option value="${opt.key}">${opt.value}</option>
                        </c:forEach>
                    </select>
                </div>
            </div>--%>
            <div class="clearFix"></div>
            <div class="btnsBox">
               <span id="searchBtn"  class="sq-button sq-button-round">查询</span>
               <span id="clearBtn" onclick="clearBtn();" class="sq-button sq-button-round">清空</span>
               <span id="addBtn" onclick="addBtn();" class="sq-button sq-button-round"><!-- <i class="sqBtnIco_3"></i> -->新增</span>
               <!-- <span id="addBtn" onclick="modifyBtn();" class="sq-button sq-button-hasicon"><i class="sqBtnIco_3"></i>修改</span> -->
            <!--   <span id="detailBtn" onclick="detailBtn();" class="sq-button sq-button-hasicon"><i class="sqBtnIco_2"></i>详细</span> -->
               <span id="flowStartBtn" class="sq-button sq-button-round" onclick="addFlowStart();">发起流程</span>
                <span id="expFlowStartBtn" class="sq-button sq-button-round" onclick="addFlowStart(1);" style="display: none">发起外派流程</span>
                <span id="preFlowStartBtn" class="sq-button sq-button-round" onclick="preFlowStart();" style="display: none">发起流程</span>
               <span id="updateBtn" class="sq-button sq-button-round" style="display:none" onclick="changeMgr();">业务移交</span>
                <span id="quaryDelPrjBscInfoList" class="sq-button sq-button-round" style="display:none" onclick="quaryDelPrjBscInfoList();">项目作废</span>
                <span id="taskTransfer" class="sq-button sq-button-round" style="display:none" onclick="taskTransferBtn();">任务交接</span>
                <span id="compCrLim"  class="sq-button sq-button-round" style="display:none" onclick="addPrjLnkCompCrLim();">设置敞口</span>
               	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span id="compCrLimText" style="color:red;display:none">当前实际敞口(元)：￥<span>${currCrAmt}</span></span>
            </div>
            <div class="pageIn2L_mid" id="templateChange" style="display:none">
            <form id="import_form">
                <div class="fieldset1 tabel_col tabel_col_1 clearFix">
                    <div class="fieldBox col_100">
                        <div class="label">业务移交</div>
                        <div class="field">
                            <jsp:include page="../../system/sysUlFilesRec/sysSysUlFilesRecUpload.jsp" flush="true" >
                                <jsp:param name="fileNum" value="1"/>
                                <jsp:param name="filePath" value="ywchange"/>
                            </jsp:include>
                            <span id="addBatchBtn" class="sq-button sq-button-hasicon" onclick="addBatch();"><i class="sqBtnIco_33"></i>批量处理</span>
                            <span id="downTempBtn" class="sq-button sq-button-hasicon" onclick="downTemp();"><i class="sqBtnIco_8"></i>下载模板</span>
                        </div>
                    </div>
                </div>
            </form>
            </div>
            <!-- 隐藏客户ID, 提供给客户管理中 项目列表使用 -->
			<div class="fieldBox col_100" style="display:none;">
		       <div class="field">
		        	<input name="cstId" id="cstId" type="text" class="ui-textbox" value="${cstId}">
		        	<input name="fromPrjFlagNm" id="fromPrjFlagId" type="text" class="ui-textbox" value="${fromPrjFlag}">
		        	<input name="cstNmNm" id="cstNmId" type="text" class="ui-textbox" value="${cstNm}">
		        	<!-- 流程跟踪 隐藏选中数据项目ID -->
		        	<input name="projectId" id="projectId" type="text" class="ui-textbox" value="">
		       </div>
		    </div>
        </div>
    </form>
</div>

<div id="ligergrid1" class="sq-grid"></div> 
</div>
    <c:if test="${empty isLoan}" >
        <div tabid="tabB" title="流程跟踪" id="tabBId">
            <iframe frameborder="0" name="tabB" id="tabB" src=""></iframe>
        </div>
    </c:if>
<div tabid="tabC" title="移交记录" id="tabCId">
	<iframe frameborder="0" name="tabC" id="tabC" src=""></iframe>
</div>
</div>
</div>


<div id="chooseFlowDIV" style="display:none">
    <div id="ligergrid_flowStart" class="sq-grid"></div>
</div>
<div id="ywchange_result" style="display:none">
	<form id="ywchange_result_form">
	</form>
</div>
<script type="text/javascript">
    var isShowLinkCrAmtBtn = $("#isShowLinkCrAmtBtn");
    var isLnkCompFlag = '${isLnkCompFlag}';
    if(isShowLinkCrAmtBtn.length&&isLnkCompFlag&&isLnkCompFlag==1){
        $("#compCrLim").show();
        $("#compCrLimText").show();
    }
    var _usrId = '${currentUsrId}';//当前用户ID

	var grid = null;
	var queryFlag = '${queryFlag}'; //只查询列表
    var addFlowFlag = '${addFlowFlag}'; //只查询列表

	var updateFlag = '${updateFlag}';//业务移交
	var taskTransfer = '${taskTransfer}';//业务交接
	var updateSunFlag = '${updateSunFlag}';//供应商及账号修改
	var splPrjViewFlag = '${splPrjViewFlag}';//供应商项目页面
	var mgrPrjViewFlag = '${mgrPrjViewFlag}';//客户经理关联项目页面
	var isLnkPrjViewFlag = '${isLnkPrjViewFlag}';//挂靠公司管理项目页面
	var prjTransfer ='${prjTransfer}';//移交记录 REQ-4030 add by gengchunlan 20190708
	var pageInApp={}; // to 下一级子窗口 接口
    var pageInTab=null;
    var expFlowStartBtnShow = '${expFlowStartBtnShow}';
    var isLoan = '${isLoan}';
	$(function () {
		initTab();
		initOrgTree();
        if (expFlowStartBtnShow != null && expFlowStartBtnShow == 'true') {
            $("#expFlowStartBtn").removeAttr("style");
        }
		$("#splPrjPoTab").hide();
		if(queryFlag=="query"){
			//隐藏按钮
			$("#addBtn").hide();
			$("#flowStartBtn").hide();
			$("#expFlowStartBtn").hide();
			$("#preFlowStartBtn").hide();
		}
		if(updateFlag=='update'){
			$("#updateBtn").show();
			$("#templateChange").show();
			$("#quaryDelPrjBscInfoList").show();//项目作废
			pageInTab.removeTabItem("tabB"); 
		}
		if(updateSunFlag=='update'){
			pageInTab.removeTabItem("tabB");  
		}
		if(taskTransfer=="query"){
			$("#taskTransfer").show();
		}
		//移交记录 REQ-4030 add by gengchunlan 20190708
		if(prjTransfer == 'query'){
		}else{
			pageInTab.removeTabItem("tabC");  
		}
		//end by gengchunlan 
		
		//客户ID做为默认查询条件, 提供给客户管理中项目列表使用
		var _cstId = $("#cstId").val();
		var params = "";//默认条件
		if(StringUtils.isNotEmpty(_cstId)){
			params = "?cstId="+_cstId
		}
		var lnkCompId = '${lnkCompId}';
		if(StringUtils.isNotEmpty(lnkCompId)){
			$("#searchPrjStsCdId").hide();
			$("#searchPrjTypCdId").hide();
			$("#searchCstNmId").hide();
			$("#searchBizTypCdId").hide();
			$("#searchCntTypCdId").hide();
			$("#searchInsCodeId").hide();
			//$("#compCrLim").show();
			$("#flowStartBtn").hide();
			$("#expFlowStartBtn").hide();
			$("#preFlowStartBtn").hide();
			$("#addBtn").hide();
            $("#searchRegionCdId").hide();
		}
		var _splId = '${splId}';
		if(splPrjViewFlag =='splPrjViewFlag'){
			$('#cstMgrOrgCdId').remove();
	    	$('#searchCstNmId').remove();
			params = "?ovdViewFlag=ovdViewFlag";
		}
		var _cstMgrId = '${cstMgrId}';
		if(mgrPrjViewFlag == 'mgrPrjViewFlag' && StringUtils.isNotEmpty(_cstMgrId)){
			$("#searchPrjNmId").remove();
	    	$("#searchCstNmId").remove();
	    	$("#searchPrjTypCdId").remove();
	    	$("#searchBizTypCdId").remove();
	    	$("#searchPrjStsCdId").remove();
	    	$("#searchBuOrgCdId").remove();
	    	$("#searchCstNmId").remove();
	    	$("#searchCntTypCdId").remove();
	    	$("#searchLsCntNoId").remove();
	    	$("#isDelId").remove();
	    	$('#cstMgrOrgCdId').remove();
	    	$('#searchCstNmId').remove();
	    	$("#searchInsCodeId").remove();
	    	//移除按钮
	    	$("#searchBtn").remove();
	    	$("#clearBtn").remove();
	    	$("#addBtn").remove();
	    	$("#flowStartBtn").remove();
            $("#expFlowStartBtn").remove();
            $("#preFlowStartBtn").remove();
            $("#searchRegionCdId").remove();
			params ="?ovdViewFlag=ovdViewFlag&cstMgrId="+_cstMgrId;
		}
		if(splPrjViewFlag =='splPrjViewFlag' || mgrPrjViewFlag == 'mgrPrjViewFlag' || '1' == isLnkPrjViewFlag){
			if(StringUtils.isEmpty(_splId) && StringUtils.isEmpty(_cstMgrId) && StringUtils.isEmpty(lnkCompId))return;
			$("#splPrjPoTab").show();
			$.ajax({
		   		type: 'get',
		   		dataType:'json',
		   		data:{
		   			splId:_splId,
		   			cstMgrId:_cstMgrId,
		   			lnkCompId:lnkCompId
		   		},
		   		url: '<%=path%>/project/prjbscinfo/getPrjPopuInfo.do',
		   		success:function(msg){
					if(msg.success == 1){
						var prjPopuInfo = msg.data.prjPopuInfo;
                        console.log("prjPopuInfo: " + prjPopuInfo);
						if(prjPopuInfo){
						    console.log("prjPopuInfo.prjNum: " + prjPopuInfo.prjNum);
							$("#prjNum").html(prjPopuInfo.prjNum);
							$("#prjSucNum").html(prjPopuInfo.prjSucNum);
							if(StringUtils.isNotEmpty(prjPopuInfo.payAmt)){
								$("#payAmt").html('&yen;'+FormatMoney(prjPopuInfo.payAmt/100));
							}
							$("#ovdPct").html(prjPopuInfo.ovdPct);
						}
					}
				}
			});
		}
	    $("#ligergrid1").ligerGrid({
	    	url: '<%=path%>/project/prjbscinfo/initList.do'+params,
	    	method : 'get',
	    	parms:{
	    		splId:_splId,
	    		lnkCompId:lnkCompId
	    	},

	        columns: [
	             { display: '项目名称', name: 'prjNm', align:'left',minWidth: 140 ,
	            	render: function (rowdata, rowindex, value, column) {
	                 // debugger;
                         if( isLoan == "" ){
                             var h = '';
                             if(value&&value!="null"){
                                 h+='<a href="javascript:prjDetailBtn(';
                                 h+="'"+rowdata.id+"',";
                                 h+=')">'+value+'</a>'
                             }
                             return h;
                         }else {
                             return value;
                         }
	            		},
	            	enabledSort:true},
	             { display: '合同号', name: 'lsCntNo', minWidth: 140 , enabledSort:true}, 
	            { display: '客户', name: 'cstNm', minWidth: 140,align:'center', enabledSort:true},
	            getOvdDaysColumn(),
	            getOvdAmtColumn(),
	            { display: '客户经理', name: 'cstMgrNm', minWidth: 140,align:'center', enabledSort:true},
	            { display: '所属机构', name: 'buOrgCdNm', width: 100 , enabledSort:true},
	            { display: '省公司', name: 'prOrgCdNm', width: 100 , enabledSort:true},
	            { display: '分公司', name: 'cyOrgCdNm', width: 100 , enabledSort:true},
	            { display: '项目类型', name: 'prjTypCdNm', width: 150, enabledSort:true},
                { display: '是否资管业务', name: 'isInsBiz', minWidth: 100 , enabledSort:true,
                    render: function (rowdata, rowindex, value, column) {
                        if (rowdata.isInsBiz == 1) {
                            return "是";
                        } else if (rowdata.isInsBiz == 0) {
                            return "否";
                        }
                    }
                },
                { display: '是否厂商业务', name: 'isSplMfr', minWidth: 100 , enabledSort:true,
                    render: function (rowdata, rowindex, value, column) {
                        if (rowdata.isSplMfr == 1) {
                            return "是";
                        } else if (rowdata.isSplMfr == 0) {
                            return "否";
                        }
                    }
                },
	            { display: '业务模式', name: 'bizTypCdNm', minWidth: 140 , enabledSort:true},
	            { display: '项目状态', name: 'prjStsCdNm', minWidth: 100 , enabledSort:true},
	            { display: '机构名称', name: 'fundRasInsNm', minWidth: 150 , enabledSort:true},
	             { display: '申请单号', name: 'pNo', minWidth: 140 , 
	              	render: function (rowdata, rowindex, value, column) { 
	            		var h = '';
            			if(value&&value!="null"){
            				if(StringUtils.isNotEmpty(rowdata.buOrgCd) && rowdata.buOrgCd==ProjectConstant.CODE_BU_ORG_CD_CAR){
		            		    h+='<a href="javascript:commShowFlowForCarBiz(';
            				}else if(StringUtils.isNotEmpty(rowdata.buOrgCd) && rowdata.buOrgCd==ProjectConstant.CODE_BU_ORG_CD_ZC){
            					if(StringUtils.isNotEmpty(rowdata.cstMgrOrgCd)){
            						var orgCd = rowdata.cstMgrOrgCd;
            						var orgCd_1 = orgCd.substring(0,12);
            						if(orgCd_1=='000000080002'){//专车客车
				            		    h+='<a href="javascript:commShowFlowForBusKCBiz(';
            						}else{
				            		    h+='<a href="javascript:commShowFlowForBusBiz(';
            						}
            					}else{
			            		    h+='<a href="javascript:commShowFlowForBusBiz(';
            					}
            				}else{
            					if(rowdata.prjTypCd=='DSFGHKDCPSZ'){
			            		    h+='<a href="javascript:commShowTempFlow(';
            					}else{
			            		    h+='<a href="javascript:commShowFlow(';
            					}
            				}
	            		    h+="'"+rowdata.pInstId+"',";
	            		    h+="'"+rowdata.prjStsCd+"',";
	            		    h+="'"+rowdata.id+"'";
	            		    h+=')">'+value+'</a>'
            			}
                        return h;
            		},
	            	enabledSort:true}, 
	            { display: '数据来源', name: 'dsCdNm', minWidth: 100 , enabledSort:true},
                /*{ display: '所属区域', name: 'cstMgrRgnCdNm', minWidth: 100 , enabledSort:true},*/

	            { display: '创建时间', name: 'crtTm', minWidth: 100 , render:renderDate, enabledSort:true},
	            getOptColumn()
	        ],
	        pageSize:10,
	        root:'rows',
	        record:'total',
	        hideLoadButton : true,
	        width: '100%',
	        height:'100%',
	        heightDiff:-20,
	        //isScroll: false,
	        checkbox:true,
	        delayLoad:true,
	        rownumbers:true,
            onSelectRow: function(rowdata, rowid, rowobj){
                // $("#projectId").val(rowdata.id);
                if (addFlowFlag == "true") {
                    if (rowdata.dsCd == CommonConstant.LCV_DS_CD) {
                        $("#flowStartBtn").hide();
                        $("#preFlowStartBtn").hide();
                    } else {
                        $("#flowStartBtn").show();
                        $("#preFlowStartBtn").hide();
                    }
                }
                //二手车项目时，隐藏发起流程，显示发起预审
                if(queryFlag != "query"){
                    if (rowdata.prjTypCd == "ESCJYD" || rowdata.prjTypCd == "CDDYWUL" || rowdata.prjTypCd == "OWNJYD"){
                        $("#preFlowStartBtn").removeAttr("style");
                        $("#flowStartBtn").hide();
                    } else {
                        $("#preFlowStartBtn").attr("style","display: none");
                        $("#flowStartBtn").show();
                    }
                }
            },
	        /* isSingleCheck:true,

			onUnSelectRow : function(rowdata, rowid, rowobj){
				$("#projectId").val('');
			},
			onAfterShowData : function () {
	        	SetIframe_height();
	        } */
	    });
	 //   initOrgTree();
	    grid = liger.get("ligergrid1");
	    grid.setHeight(100);
	    $("#searchBar").ligerForm();
	    $("#searchBtn").click(function(event) {
	         var form = new liger.get("searchBar");
	         var data = form.getData();
	         data["crtTm"] = $("#crtTm").val();
	         for (name in data){
	            grid.setParm(name,data[name]);
	         };
	        grid.reload();
	    });
	
	    var form = new liger.get("searchBar");
        var data = form.getData();
        data["crtTm"] = $("#crtTm").val();
        for (name in data){
           grid.setParm(name,data[name]);
        };
        data["splId"]=_splId;
        data["lnkCompId"]=lnkCompId;
        if(StringUtils.isNotEmpty(_cstId)){
        	 data["cstId"]=_cstId;
		}
        grid.reload();
	    $("#pageloading").hide();
	});
	    
	    
	function initOrgTree(){
    	var params = {};
    	if(queryFlag=="query"){
    		params.userId = '${currentUserId}';
    	}
    	params.cstMgrOrgCd = '${currOrg}';
    	 searchOrgTree = $("#cstMgrOrgCd").ligerComboBox({
    		 width: 480,
             selectBoxWidth: 480,
             selectBoxHeight: 150,
             //限制只能选叶节点，父节点不能点击
             treeLeafOnly: false,
             valueField: 'orgCd',
             textField: 'orgDispNm',
             showTreePath: true,
             tree: {
                 ajaxType: 'get',
                 idFieldName:'orgCd',
                 textFieldName: 'orgDispNm',
                 checkbox: false,
                 parentIcon: "none",
                 childIcon: "none",
                 needCancel : false
             }
         });
    	 $.ajax({
     		type: 'get',
     		dataType:'json',
     		data: params,
     		url: '<%=path%>/project/prjbscinfo/searchBuOrgTree.do',
     		success:function(msg){
     			if(msg.success == 1){
     				searchOrgTree.treeManager.setData(msg.data);
     				searchOrgTree.clear();
     				searchOrgTree.setValue('${currOrg}');
     			}else{
     				 $.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
     			}
     		}
     	});

    }    
	    
	var loadedTabs = [];
	//初始化Tab页签
	function initTab(){
		pageInTab = $("#pageInTab").ligerTab({
			height: 'auto',
			contextmenu: false,
			minIframeHeight: GET_minIframeHeight(),
			onBeforeSelectTabItem: function(tabid) {
				var selectedRows = grid.getSelectedRows();
				//var projectId = $("#projectId").val();
				if(tabid!="tabA" && tabid!="tabC"){
					if (selectedRows.length != 1) {
			             $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_ONLY_A_ROW, SQ_type: "warning"});
			             return false;
			         }
					/* if(!projectId){
						$.ligerDialog.SQalert({content: "请选择一条信息！", SQ_type: "warning"});
						return false;
					} */
				}
			},
			onAfterSelectTabItem: function(tabid) {
				var selectedRows = grid.getSelectedRows();
				var projectId = $("#projectId").val();
				if(tabid!="tabA" && tabid!="tabC"){
					if (selectedRows.length != 1) {
			             $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_ONLY_A_ROW, SQ_type: "warning"});
			             return false;
			         }else{
							if (loadedTabs.indexOf(selectedRows[0].id)<0) {
								loadedTabs = [];
								loadedTabs.push(selectedRows[0].id);
								switch (tabid){
									case "tabB":							
										pageInTab.setTabItemSrc(tabid, "<%=path%>/project/audit/toProjectFlowPage.do?prjId="+selectedRows[0].id+"&prjTypCd="+selectedRows[0].prjTypCd);
										break;
								}
							}
							SetIframe_height();
						}
					<%--  if(!projectId){
						$.ligerDialog.SQalert({content: "请选择一条信息！", SQ_type: "warning"});
						return false;
					} else{
						if (loadedTabs.indexOf(projectId)<0) {
							loadedTabs = [];
							loadedTabs.push(projectId);
							switch (tabid){
								case "tabB":							
									pageInTab.setTabItemSrc(tabid, "<%=path%>/project/audit/toProjectFlowPage.do?prjId="+projectId);
									break;
							}
						}
						SetIframe_height();
					} --%>
				}
				//移交记录 REQ-4030 add by gengchunlan 20190708
				if(tabid=="tabC"){
					pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjtransferinfo/toListPage.do?");
					SetIframe_height();
				}//end by gengchunlan 20190708
				
				
			}
		});
		$.extend(true, pageInApp, {
            pageInTab: pageInTab
        });
	};
	//获取逾期天数列
	function getOvdDaysColumn(){
		if(splPrjViewFlag =='splPrjViewFlag' || mgrPrjViewFlag =='mgrPrjViewFlag'){
			var column ={ display: '逾期天数', name: 'ovdDays', minWidth: 80,align:'center', enabledSort:true};
			return column;
		}
	}
	//获取逾期金额列
	function getOvdAmtColumn(){
		if(splPrjViewFlag =='splPrjViewFlag' || mgrPrjViewFlag =='mgrPrjViewFlag'){
			var column ={ display: '逾期金额', name: '', minWidth: 140,align:'center', enabledSort:true,
					render:function(rowdata,index,value){
						if(StringUtils.isEmpty(rowdata.ovdAmt)) return;
                        return '&yen;'+FormatMoney(rowdata.ovdAmt/100);
                    }		
			};
			return column;
		}
	}
	//获取操作列
	function getOptColumn(){
		//添加挂靠公司页面判断 添加敞口页面判断
		if('1' == isLnkPrjViewFlag || (isShowLinkCrAmtBtn.length&&isLnkCompFlag&&isLnkCompFlag==1)){
			var column = {
	                display: '操作',
	                isSort: false,
	                width: 200,
	                align:'left',
	                render: function (rowdata, rowindex, value){
	                	var h="";
	                    h+='<a class="sq-button-hasicon" href="javascript:getscore(';
	                    h+="'"+rowdata.id+"'";
	                    h+=')"><i class="sqBtnIco_2"></i>评分</a>';
	                    return h;
	                }
	            }
			return column;
		}
		if(queryFlag!="query"){
		var column = {
                display: '操作',
                isSort: false,
                width: 300,
                align:'left',
                render: function (rowdata, rowindex, value){
                	 var h="";
                    if(rowdata.prjTypCd=='CDDYW'){
                        return h;
                    }
                	 if(rowdata.isDel!=1){
                	        //商家 轻卡 项目 不操作 删除 修改
		                	if(((rowdata.prjStsCd==CommonConstant.C_AUD_NO_HAPPEN_CODE||rowdata.prjStsCd==CommonConstant.C_AUD_NO_PASS_CODE || rowdata.prjStsCd=="10")
                            && rowdata.dsCd != CommonConstant.LCV_DS_CD)){
		                        h+='<a class="sq-button-hasicon" href="javascript:modifyBtn(';
		                        h+="'"+rowdata.id+"'";
		                        h+=')"><i class="sqBtnIco_4"></i>修改</a>'
		                        h+='<a class="sq-button-hasicon" href="javascript:removeBtn(';
		                        h+="'"+rowdata.id+"'";
		                        h+=')"><i class="sqBtnIco_7"></i>删除</a>'
		           		 	}
                	 }
                    
                    h+='<a class="sq-button-hasicon" href="javascript:getscore(';
                    h+="'"+rowdata.id+"'";
                     h+=')"><i class="sqBtnIco_2"></i>评分</a>'
                    if(rowdata.isDel!=1 && rowdata.isSendToRecoder == "0"){
                            h+='<a class="sq-button-hasicon" href="javascript:sendToRecoder(';
                            h+="'"+rowdata.id+"'";
                            h+=')"><i class="sqBtnIco_4"></i>发送至录单员</a>';
                    }
                    return h;
                }
            }
		return column;
		}else if(updateSunFlag!='update'){
			var column = {
	                display: '操作',
	                isSort: false,
	                width: 500,
	                align:'left',
	                render: function (rowdata, rowindex, value){
	                    var orgCd = rowdata.buOrgCd
	                	 var h="";
	                    h+='<a class="sq-button-hasicon" href="javascript:detailBtn(';
	                    h+="'"+rowdata.id+"'";
	                    h+=')"><i class="sqBtnIco_2"></i>详情</a>';
                        var j="";
                        j+='<sys:funcAuth resCd="prjCreditQuery"><a class="sq-button-hasicon" href="javascript:searchCredit(';
                        j+="'"+rowdata.id+"'";
                        j+=')"><i class="sqBtnIco_1"></i>征信查询</a></sys:funcAuth>';
                        var k="";
                        k+='<sys:funcAuth resCd="relationMap"><a class="sq-button-hasicon" href="javascript:visual(';
                        k+="'"+rowdata.id+"',";
                        k+="'"+rowdata.certNo+"'";
                        k+=')"><i class="sqBtnIco_1"></i>关联图谱</a></sys:funcAuth>';
                        var l="";
                        l+='<sys:funcAuth resCd="relationMapHistory"><a class="sq-button-hasicon" href="javascript:visualHistory(';
                        l+="'"+rowdata.id+"',";
                        l+="'"+rowdata.certNo+"'";
                        l+=')"><i class="sqBtnIco_1"></i>快照页面</a></sys:funcAuth>';

                        var n="";

                        n+='<sys:funcAuth resCd="prjStatistical"><a class="sq-button-hasicon" href="javascript:statistical(';
                        n+="'"+rowdata.id+"'";
                        n+=')"><i class="sqBtnIco_1"></i>敞口统计</a></sys:funcAuth>';

                        var m ="";
                        m+='<sys:funcAuth resCd="prjStatistical"><a class="sq-button-hasicon" href="javascript:statistical2(';
                        m+="'"+rowdata.id+"'";
                        m+=')"><i class="sqBtnIco_1"></i>敞口统计</a></sys:funcAuth>';
                        if(ProjectConstant.CODE_BU_ORG_CD_QK === orgCd){
                            return h + j + k + l + m;
                        }
	                    return h + j + k + l + n;
	                }
	            }
			return column;
		}else{
			var column = {
	                display: '操作',
	                isSort: false,
	                width: 200,
	                align:'left',
	                render: function (rowdata, rowindex, value){
	                	 var h="";
	                    h+='<a class="sq-button-hasicon" href="javascript:updateInfo(';
	                    h+="'"+rowdata.id+"'";
	                    h+=')"><i class="sqBtnIco_2"></i>账号变更</a>';
	                    h+='<a class="sq-button-hasicon" href="javascript:updateDtl(';



	  h+="'"+rowdata.id+"',";
	                    h+="'"+rowdata.buOrgCd+"'";
	                    h+=')"><i class="sqBtnIco_2"></i>修改明细</a>';
	                    return h;
	                }
	            }
			return column;
		}
	}
	//显示流程
    function commShowFlow(_pInstId, _audStsCd, _businessKey){
    	if(StringUtils.isEmpty(_pInstId)){
    		UIUtils.alertWarning(CommonConstant.C_P_INSTANCEID_NOT_HERE);
    		return;
    	}
    	var _formUrl = "/project/audit/toAdditionalInfoPage.do?isDetail=1"+"@@processInstanceId="+_pInstId+"@@projectId=";
    	var params = "?pInsId="+_pInstId+"&status="+_audStsCd+"&businessKey="+_businessKey+"&formUrl="+_formUrl;
    	Add_navTab('tab_cst_invoice_flow_'+_businessKey,'查看流程',"<%=path%>/flow/flow/toFlowShowPageFowBus.do"+params);
    }
	
	//显示流程
    function commShowTempFlow(_pInstId, _audStsCd, _businessKey){
    	if(StringUtils.isEmpty(_pInstId)){
    		UIUtils.alertWarning(CommonConstant.C_P_INSTANCEID_NOT_HERE);
    		return;
    	}
    	var _formUrl = "/project/audit/toTempAdditionalInfoPage.do?isDetail=1"+"@@processInstanceId="+_pInstId+"@@projectId=";
    	var params = "?pInsId="+_pInstId+"&status="+_audStsCd+"&businessKey="+_businessKey+"&formUrl="+_formUrl;
    	Add_navTab('tab_cst_invoice_flow_'+_businessKey,'查看流程',"<%=path%>/flow/flow/toFlowShowPageFowBus.do"+params);
    }
	
	//乘用车流程
    function commShowFlowForCarBiz(_pInstId, _audStsCd, _businessKey){
    	if(StringUtils.isEmpty(_pInstId)){
    		UIUtils.alertWarning(CommonConstant.C_P_INSTANCEID_NOT_HERE);
    		return;
    	}
    	var _formUrl = "/project/audit/toCarBizAdditionalInfoPage.do?isDetail=1"+"@@processInstanceId="+_pInstId+"@@projectId=";
    	var params = "?pInsId="+_pInstId+"&status="+_audStsCd+"&businessKey="+_businessKey+"&formUrl="+_formUrl;
    	Add_navTab('tab_cst_invoice_flow_'+_businessKey,'查看流程',"<%=path%>/flow/flow/toFlowShowPageFowBus.do"+params);
    }
	//专车以租代购流程
    function commShowFlowForBusBiz(_pInstId, _audStsCd, _businessKey){
    	if(StringUtils.isEmpty(_pInstId)){
    		UIUtils.alertWarning(CommonConstant.C_P_INSTANCEID_NOT_HERE);
    		return;
    	}
    	var _formUrl = "/project/audit/toBusAdditionalInfoPage.do?isDetail=1"+"@@processInstanceId="+_pInstId+"@@projectId=";
    	var params = "?pInsId="+_pInstId+"&status="+_audStsCd+"&businessKey="+_businessKey+"&formUrl="+_formUrl;
    	Add_navTab('tab_cst_invoice_flow_'+_businessKey,'查看流程',"<%=path%>/flow/flow/toFlowShowPageFowBus.do"+params);
    }
	//专车客车流程
    function commShowFlowForBusKCBiz(_pInstId, _audStsCd, _businessKey){
    	if(StringUtils.isEmpty(_pInstId)){
    		UIUtils.alertWarning(CommonConstant.C_P_INSTANCEID_NOT_HERE);
    		return;
    	}
    	var _formUrl = "/project/audit/toBusAdditionalInfoPage.do?isBusKC=1@@isDetail=1"+"@@processInstanceId="+_pInstId+"@@projectId=";
    	var params = "?pInsId="+_pInstId+"&status="+_audStsCd+"&businessKey="+_businessKey+"&formUrl="+_formUrl;
    	Add_navTab('tab_cst_invoice_flow_'+_businessKey,'查看流程',"<%=path%>/flow/flow/toFlowShowPageFowBus.do"+params);
    }
	
	//格式化时间
	function renderDate(rowdata, index, value){
		var dateStr = "";
		if(null != value){
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
		}
		return dateStr;
	}
	
	function updateDtl(id,buOrgCd){
		Add_navTab("prjModify"+id, "修改项目信息", '<%=path%>/project/prjbscinfo/toModifyPage.do?showTabs=tabG&detailFlag=false&ywParam=1&id='+id+'&buOrgCd='+buOrgCd);
	}
	function addBtn(){
		
		var callback = function(){
			 grid.reload();
		}
		var fromPrjFlag = true;
		var _flag = $("#fromPrjFlagId").val();//来自哪里
		if(StringUtils.isNotEmpty(_flag)){
			if(_flag == 'false'){
				fromPrjFlag = false;
			}
		}
		//查询参数
		var params = "?fromPrjFlag="+fromPrjFlag;
		
		//如果客户ID存在则加入参数
		var _cstId = $("#cstId").val();//客户ID
		var _cstNm = $("#cstNmId").val();//客户名称
		if(StringUtils.isNotEmpty(_cstId)){
			params+= "&cstId="+_cstId+"&cstNm="+_cstNm
		}

		var timestamp=new Date().getTime();
		Add_navTab('tab_prj_bsc_info_add'+timestamp,'添加项目信息','<%=path%>/project/prjbscinfo/toAddPage.do'+params,callback);
	}
    function sendToRecoder(id){
        if(!id)return;
        $.ligerDialog.SQconfirm('确定发送至录单员吗？', function (yes) {
            if(yes == false){
                return;
            }
            $.ajax({
                type: 'post',
                dataType:'json',
                data: {
                    prjId: id,
                    bookTypeCd:"6"
                },
                url: '<%=path%>/audit/audStandingBook/sendToRecoder.do' ,
                success:function(msg){
                    if(msg.success == 1){
                        top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
                        grid.reload();
                    }else{
                        top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
                    }
                }
            });
        });
    }
	function modifyBtn(id){
		var callback = function(){
			 grid.reload();
		}
		/* var selectedRows = grid.getSelectedRows();
		if(selectedRows.length != 1){
			$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_ONLY_A_ROW, SQ_type: "warring"});
			return;
		} */
		var fromPrjFlag = true;
		var _flag = $("#fromPrjFlagId").val();//来自哪里
		if(StringUtils.isNotEmpty(_flag)){
			if(_flag == 'false'){
				fromPrjFlag = false;
			}
		}
		//查询参数
		var detailFlag = false;
        // 客户经理修改flag
		var fromCMFlag = true;
		var params = "?fromPrjFlag="+fromPrjFlag+"&id="+id+"&detailFlag="+detailFlag + "&fromCMFlag=" + fromCMFlag;
		//如果客户ID存在则加入参数
		var _cstId = $("#cstId").val();//客户ID
		var _cstNm = $("#cstNmId").val();//客户名称
		if(StringUtils.isNotEmpty(_cstId)){
			params+= "&cstId="+_cstId+"&cstNm="+_cstNm
		}
		//var id = selectedRows[0].id;
		Add_navTab('tab_prj_bsc_info_add'+id,'修改项目信息','<%=path%>/project/prjbscinfo/toModifyPage.do'+params,callback);
	}
	//删除所选项目信息
	function removeBtn(id){
		var _ids = [];
			_ids.push(id);
		$.ligerDialog.confirm(LogUtils.LOG_CMM_DELETE_CONFIRM, function (flag) {
			if(flag == false)return;
			$.ajax({
				type: 'post',
				dataType:'json',
				data:{ids:JSON.stringify(_ids)},
				url: '<%=path%>/project/prjbscinfo/removeByIds.do',
				success:function(msg){
					 if(msg.success == 1){
						 top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
						 grid.reload();
					 }else{
						 top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
					 }
				}
			});
		});
	}
	
	function quaryDelPrjBscInfoList(){
		Add_navTab('tab_project_query_list','项目列表','<%=path%>/project/prjbscinfo/toPrjBscInfoForDelQuaryListPage.do');
	}
	function prjDetailBtn(id){
		var fromPrjFlag = true;
		var detailFlag = true;
		
		var _flag = $("#fromPrjFlagId").val();//来自哪里
		if(StringUtils.isNotEmpty(_flag)){
			if(_flag == 'false'){
				fromPrjFlag = false;
			}
		}
		
		Add_navTab('tab_project_detail'+id,'项目详情','<%=path%>/project/prjbscinfo/toModifyPage.do?fromPrjFlag='+fromPrjFlag+'&&id='+id+'&&detailFlag='+detailFlag);
	}
function detailBtn(id){
    /* var selectedRows = grid.getSelectedRows();
    if(selectedRows.length != 1){
        $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_ONLY_A_ROW, SQ_type: "warring"});
        return;
    }

    var id = selectedRows[0].id; */
    var fromPrjFlag = true;
    var detailFlag = true;

    var _flag = $("#fromPrjFlagId").val();//来自哪里
    if(StringUtils.isNotEmpty(_flag)){
        if(_flag == 'false'){
            fromPrjFlag = false;
        }
    }

    Add_navTab('tab_project_detail'+id,'项目详情','<%=path%>/project/prjbscinfo/toModifyPage.do?fromPrjFlag='+fromPrjFlag+'&&id='+id+'&&detailFlag='+detailFlag+'&&isInsBiz=');
}
    function searchCredit(_projectId) {
        if(!_projectId)return;
        $.ligerDialog.SQconfirm('确定查询征信吗？', function (yes) {
        	if(yes == false){
        		return;
        	}
	        Add_navTab("toTripartitePage"+_projectId, "人行征信及三方", '<%=path%>/riskctrl/rskctrl/toMainPage.do?id='+_projectId);
        });
    }

    function visual(prjId, certNo){
        // SEC-295 页面跳转调整
        Add_navTab('tab_spl_grp_memb_dev_amt_rankvisual'+prjId,'狮桥关联图谱','<%=path%>/knowledgeGraph/init/initGraphVisualPage.do?prjId=' + prjId + "&c_no=" + certNo + "&usrId=" + _usrId);
    }

    function visualHistory(prjId, certNo){
        // SEC-295 页面跳转调整
        Add_navTab('tab_spl_grp_memb_dev_amt_rankvisualHistory'+prjId,'狮桥快照页面','<%=path%>/knowledgeGraph/init/initGraphVisualHistoryPage.do?prjId=' + prjId + "&c_no=" + certNo + "&usrId=" + _usrId);
    }

    //敞口统计
    function statistical(prjId) {

        Add_navTab('tab_spl_grp_memb_dev_amt_prjStatistical'+prjId,'敞口统计','<%=path%>/exposure/capPrjArInfo/toExposureCapPrjArInfoPage.do?prjId=' + prjId +  "&exposureSource=1");
    }
    //轻卡敞口统计
    function statistical2(prjId) {

        Add_navTab('tab_spl_grp_memb_dev_amt_prjStatistical'+prjId,'敞口统计','<%=path%>/exposure/capPrjArInfo/toArInfoTable.do?prjId=' + prjId +  "&isShowCondition=1");
    }

	//启动流程
	function flowStart(){
		var selectedRows = grid.getSelectedRows();
        if (selectedRows.length != 1) {
            $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_ONLY_A_ROW, SQ_type: "warning"});
            return;
        }
        var prjStsCd = selectedRows[0].prjStsCd;//项目状态
        if(prjStsCd=="1" || prjStsCd=="4"){
            $.ligerDialog.SQalert({content: "项目审核中,不允许多次发起流程.", SQ_type: "warning"});
            return;
        }else if(prjStsCd=="2"){
            $.ligerDialog.SQalert({content: "项目审核通过,不允许再次发起流程.", SQ_type: "warning"});
            return;
        }else if(prjStsCd=="3"){
            $.ligerDialog.SQalert({content: "项目审核不通过,不允许再次发起流程.", SQ_type: "warning"});
            return;
        }
        var modelTyp = FlowConstant.FLOW_MODEL_TYP_PRJ;
        var flowDialog = $.ligerDialog.SQopen({
            url: '<%=path%>/flow/flow/toForStartListPage.do?modelTyp='+modelTyp,
            width: 700,
            height:400,
            title : '请选择要发起的流程',
            buttons: [{
	                text: "确定", type: 'ok', cls: 'l-dialog-btn-ok',
	                onclick: function (item, Dialog) {
	                    if (Dialog.onOk) Dialog.onOk();
	                }
	            }, {
	                text: "取消", type: 'cancel', cls: 'l-dialog-btn-no',
	                onclick: function (item, Dialog) {
	                    if (Dialog.onCancel) Dialog.onCancel();
	                }
	            }
	        ],
            onClose: function () {
            	var json = flowDialog._DATA;
            	console.log(json);
            	if(!json){
                	return;
            	}
            	var wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting",onClose: function () {}});
        		var _id = selectedRows[0].id;
        		$.ajax({
            		type: 'post',
            		dataType:'json',
            		data:{
            			id:_id,
            			procDefKey:json.procDefKey,
            			procDefId:json.procDefId,
            			procNo:json.procNo
            		},
            		url: '<%=path%>/project/prjbscinfo/addFlowStart.do',
            		success:function(msg){
            			wait_dialog.close();
            			 if(msg.success == 1){
           					 UIUtils.alertSuccessHold1(msg.info);
            				 grid.reload();
            			 }else{
           					 UIUtils.alertErrorHold1(msg.info);
            			 }
            		}
            	});
            }
        });
	}
	// 自定义按钮文本
    $.ligerDefaults.ButtonStrings = {
        yes: '是',
        onlyHTCity: '否,仅发起城配流程',
        onlyAP: '否,仅发起提前放款'
    };
    // 自定义按钮的弹出框
    function expatriateFlowDialog (content, title, callback, left, right)
    {
        if (typeof (title) == "function")
        {
            callback = title;
            type = null;
        }
        var btnclick = function (item, Dialog)
        {
            Dialog.close();
            if (callback)
            {
                callback(item.type == 'ok');
            }
        };
        p = {
            type: 'question',
            content: content,
            buttons: [
                {
                    text: left, onclick: btnclick, type: 'ok', cls: 'l-dialog-btn-ok'
                }, {
                    text: right, onclick: btnclick, type: 'no', cls: 'l-dialog-btn-no'
                }
            ]
        };
        if (typeof (title) == "string" && title != "") p.title = title;
        $.extend(p, {
            showMax: false,
            showToggle: false,
            showMin: false,
            width: 300,
            height: 100

        });
        return $.ligerDialog(p);
    };

    //二手车项目发起预审，为什么新写：发起预审时，允许尚未有产品信息，所以一系列校验都不满足
    function preFlowStart() {
        var selectedRows = grid.getSelectedRows();
        if (selectedRows.length != 1) {
            $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_ONLY_A_ROW, SQ_type: "warning"});
            return;
        }
        var prjStsCd = selectedRows[0].prjStsCd;//项目状态
        var prjId = selectedRows[0].id;
        if(prjStsCd=="1" || prjStsCd=="4" || prjStsCd=="5" || prjStsCd=="6" || prjStsCd=="7" || prjStsCd=="8" || prjStsCd=="9"){
            $.ligerDialog.SQalert({content: "项目审核中,不允许多次发起流程.", SQ_type: "warning"});
            return;
        }else if(prjStsCd=="2"){
            $.ligerDialog.SQalert({content: "项目审核通过,不允许再次发起流程.", SQ_type: "warning"});
            return;
        }else if(prjStsCd=="3" || prjStsCd=="10"){
            $.ligerDialog.SQalert({content: "项目审核不通过,不允许再次发起流程.", SQ_type: "warning"});
            return;
        }
        var prjTypCd = selectedRows[0].prjTypCd;//项目类型
        if('CDDYW' === prjTypCd){
            $.ligerDialog.SQalert({content: "车抵贷业务不支持手动发起流程.", SQ_type: "warning"});
            return;
        }
        //客户主要信息变更流程中不允许发起项目评审流程
        var cstId = selectedRows[0].cstId; //客户ID
        if(checkCstModFlow(cstId) == 1){
            return;
        }

        $.ligerDialog.confirm(FlowConstant.FLOW_ADD_START_CONFIRM, function (flag) {
            if (flag == false) {
                return;
            } else {
                var wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting",onClose: function () {}});
                $.ajax({
                    type: 'post',
                    dataType:'json',
                    url: '<%=path%>/project/audit/addPreAudFlowStart.do?prjId='+prjId,
                    success:function(msg){
                        wait_dialog.close();
                        if(msg.success == 1){//成功发起流程
                            wait_dialog.close();
                            UIUtils.alertSuccessHold1(msg.info);
                            grid.reload();
                        }else if(msg.success == 0){//错误
                            wait_dialog.close();
                            UIUtils.alertErrorHold1(msg.info);
                        }else if(msg.success ==2){//找到多个流程
                            wait_dialog.close();
                            console.log(msg.data);
                            var __DATA_radioList = msg.data;
                            var selectedVal = '';
                            var selectDialog = $.ligerDialog.SQopen({
                                width: 300,
                                height: 200,
                                title : '请选择要发起的流程',
                                allowClose: false,
                                content: '<div id="radiolist1"></div>',
                                fixButtons: true, //固定按钮到底部
                                onOk: function () {
                                    console.log(selectDialog);
                                    console.log(selectedVal);
                                    if(StringUtils.isEmpty(selectedVal)){
                                        $.ligerDialog.SQalert({content: "请选择要发起的流程.", SQ_type: "warning"});
                                        return;
                                    }else{
                                        selectDialog.close();
                                        var wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting",onClose: function () {}});
                                        $.ajax({
                                            type: 'post',
                                            dataType:'json',
                                            url: '<%=path%>/project/audit/addPreAudFlowStart.do?prjId='+prjId+'&procDefKey='+selectedVal,
                                            success:function(msg){
                                                wait_dialog.close();
                                                if(msg.success == 1){//成功发起流程
                                                    UIUtils.alertSuccessHold1(msg.info);
                                                    grid.reload();
                                                }else if(msg.success == 0){//错误
                                                    UIUtils.alertErrorHold1(msg.info);
                                                }
                                            }
                                        })
                                    }
                                }
                            });
                            $("#radiolist1").ligerRadioList({
                                data: __DATA_radioList,
                                textField: 'procNm',
                                valueField: 'procDefKey',
                                rowSize: 1,
                                onSelect: function (data)
                                {
                                    console.log(data);
                                    selectedVal = data.value;
                                }
                            });
                        }
                    }
                });
            }
        });
    }
	
	//2017-4-7 发起流程
	function addFlowStart(flowTypeKey){
        // flowTypeKey 0:原流程 1:随州外派
	    if (typeof (flowTypeKey) == "undefined" || flowTypeKey == null) {
            flowTypeKey = 0;
        }
		var selectedRows = grid.getSelectedRows();
        if (selectedRows.length != 1) {
            $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_ONLY_A_ROW, SQ_type: "warning"});
            return;
        }
        var prjStsCd = selectedRows[0].prjStsCd;//项目状态
        // 项目外派流程通过后，可发起项目评审流程
        var pNoNm = selectedRows[0].pNo;
        var isExpFlowPass = false;
        if (null != pNoNm && "" != pNoNm && pNoNm.indexOf("项目外派") != -1) {
            isExpFlowPass = true;
        }
        if(prjStsCd=="1" || prjStsCd=="4" || prjStsCd=="5" || prjStsCd=="6"){
            $.ligerDialog.SQalert({content: "项目审核中,不允许多次发起流程.", SQ_type: "warning"});
            return;
        }else if(prjStsCd=="2" && flowTypeKey == 0 && isExpFlowPass == false){
            $.ligerDialog.SQalert({content: "项目审核通过,不允许再次发起流程.", SQ_type: "warning"});
            return;
        }else if(prjStsCd=="3"){
            $.ligerDialog.SQalert({content: "项目审核不通过,不允许再次发起流程.", SQ_type: "warning"});
            return;
        }
        var prjTypCd = selectedRows[0].prjTypCd;//项目类型
        if('CDDYW' === prjTypCd){
            $.ligerDialog.SQalert({content: "车抵贷业务不支持手动发起流程.", SQ_type: "warning"});
            return;
        }

        //客户主要信息变更流程中不允许发起项目评审流程-BUG-5717
        var cstId = selectedRows[0].cstId; //客户ID
        if(checkCstModFlow(cstId) == 1){
            return;
        }

        // 项目类型：车抵贷业务线下，校验规则如下：所有车辆都必须增加车牌号；必须有一台车的车牌号是征信结果有效的车牌号
        if ('CDDYWUL' === prjTypCd) {
            console.log("项目类型:"+ prjTypCd)
            var f = 0;
            var info = "";
            var prjId = selectedRows[0].id;
            console.log("车抵贷业务线下，发起流程PrjId: " + prjId);
            $.ajax({
                type: 'get',
                dataType: 'json',
                async: false,
                url: '<%=path%>/project/prjprddtl/modifyVehNo.do?prjId=' + prjId,
                success: function (data) {
                    if (data.success == 0) {
                        info = data.info;
                        f = 1;
                    }
                }
            });
            if (f == 1){
                $.ligerDialog.SQalert({content: info, SQ_type: "warning"});
                return;
            }
        }

        // 发起流程弹窗校验
        var expatriateFlowAuth = false;
        console.log("项目类型->" + prjTypCd);
        if (flowTypeKey != 1 && ('CPYW' === prjTypCd || 'DSFZGCP' === prjTypCd || 'CSYWCP' === prjTypCd)) {
            // 弹窗：是否同时发起随州垫款流程
            $.ajax({
                type: 'post',
                dataType: 'json',
                async: false,
                data: {
                    prjId: selectedRows[0].id
                },
                url: '<%=path%>/project/audit/checkExpatriateFlowAuth.do?',
                success: function (data) {
                    if (data.success == 1) {
                        // 可发起，垫款弹窗
                        expatriateFlowAuth = true;
                    }
                }
            });
        }
        var startExpatriateFlow = 0;
        // 可发起
        if (expatriateFlowAuth) {
            expatriateFlowDialog (FlowConstant.EXPATRIATE_FLOW_ADD_START_CONFIRM, '提示', function (flag) {
                if (flag == true) {
                    // 发起垫款标识
                    startExpatriateFlow = 1;
                    // 发起流程确认
                    addFlowStartConfirm(selectedRows, flowTypeKey, startExpatriateFlow);
                } else {
                    // 发起流程确认
                    addFlowStartConfirm(selectedRows, flowTypeKey, startExpatriateFlow);
                }
            }, $.ligerDefaults.ButtonStrings.yes, $.ligerDefaults.ButtonStrings.onlyHTCity);
        } else {
            $.ligerDialog.confirm(FlowConstant.FLOW_ADD_START_CONFIRM, function (flag) {
                if (flag == false) {
                    return;
                } else {
                    // 发起流程确认
                    addFlowStartConfirm(selectedRows, flowTypeKey, startExpatriateFlow);
                }
            });
        }

        // todo 以下抽取到方法 by liuqihao -> function addFlowStartConfirm(selectedRows, flowTypeKey, startExpatriateFlow) {}
        //发起流程确认  2017-6-8 by YAOXIURONG
        <%--$.ligerDialog.confirm(FlowConstant.FLOW_ADD_START_CONFIRM, function (flag) {--%>
		<%--	if(flag == false){--%>
        <%--        // wait_dialog.close();--%>
		<%--	    return;--%>
        <%--    };--%>
	    <%--    var prjId = selectedRows[0].id;--%>

        <%--    // 在项目流程发起的同时，发起供应商账号、供应商返利账号、销售返利账号的流程（如果账号审核状态是未提交和未通过的前提下）huangkailun--%>
        <%--    $.ajax({--%>
        <%--        type: 'get',--%>
        <%--        dataType:'json',--%>
        <%--        async: false,--%>
        <%--        url: '<%=path%>/project/prjbscinfo/queryAccStsAndGetFlowParams.do?prjId='+prjId,--%>
        <%--        success:function(data){--%>
        <%--            if(data.success == 1){--%>
        <%--                var splFLow = data.data.splFlow;--%>
        <%--                var splBackFlow = data.data.splBackFlow;--%>
        <%--                var saleRebAccFlow = data.data.saleRebAccFlow;--%>
        <%--                if (splFLow == 'spl') {--%>
        <%--                    $.ajax({--%>
        <%--                        type: 'post',--%>
        <%--                        dataType:'json',--%>
        <%--                        async: false,--%>
        <%--                        data:{--%>
        <%--                            id:data.data.splId,--%>
        <%--                            procDefKey:data.data.splProcDefKey,--%>
        <%--                            procDefId:data.data.splProcDefId,--%>
        <%--                            procNo:data.data.splProcNo,--%>
        <%--                            modelTyp:data.data.splModelTyp--%>
        <%--                        },--%>
        <%--                        url: '<%=path%>/commonBankAcc/flow/startAccessFlow.do',--%>
        <%--                        success:function(data){--%>

        <%--                        }--%>
        <%--                    });--%>
        <%--                }--%>
        <%--                if (splBackFlow == 'splBack'){--%>
        <%--                    $.ajax({--%>
        <%--                        type: 'post',--%>
        <%--                        dataType:'json',--%>
        <%--                        async: false,--%>
        <%--                        data:{--%>
        <%--                            id:data.data.splBackId,--%>
        <%--                            procDefKey:data.data.splBackProcDefKey,--%>
        <%--                            procDefId:data.data.splBackProcDefId,--%>
        <%--                            procNo:data.data.splBackProcNo,--%>
        <%--                            modelTyp:data.data.splBackModelTyp--%>
        <%--                        },--%>
        <%--                        url: '<%=path%>/commonBankAcc/flow/startAccessFlow.do',--%>
        <%--                        success:function(data){--%>

        <%--                        }--%>
        <%--                    });--%>
        <%--                }--%>
        <%--                if (saleRebAccFlow == 'saleRebAcc') {--%>
        <%--                    $.ajax({--%>
        <%--                        type: 'post',--%>
        <%--                        dataType:'json',--%>
        <%--                        async: false,--%>
        <%--                        data:{--%>
        <%--                            id:data.data.saleRebAccId,--%>
        <%--                            procDefKey:data.data.saleRebAccProcDefKey,--%>
        <%--                            procDefId:data.data.saleRebAccProcDefId,--%>
        <%--                            procNo:data.data.saleRebAccProcNo,--%>
        <%--                            modelTyp:data.data.saleRebAccModelTyp--%>
        <%--                        },--%>
        <%--                        url: '<%=path%>/commonBankAcc/flow/startAccessFlow.do',--%>
        <%--                        success:function(data){--%>

        <%--                        }--%>
        <%--                    });--%>
        <%--                }--%>

        <%--            }--%>
        <%--        }--%>
        <%--    });--%>

        <%--    var wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting",onClose: function () {}});--%>
        <%--    var isOk = true;//是否验证通过--%>
        <%--    //验证客户风险状态--%>
        <%--    $.ajax({--%>
        <%--        type: 'get',--%>
        <%--        dataType:'json',--%>
        <%--        async: false,--%>
        <%--        url: '<%=path%>/risk/rskCstSignLog/searchRskSts.do?prjId='+selectedRows[0].id,--%>
        <%--        success:function(data){--%>
        <%--            wait_dialog.close();--%>
        <%--            if(data.success != 1){--%>
        <%--                $.ligerDialog.SQalert({content: data.info, SQ_type: "error",SQ_showButtons : true});--%>
        <%--                isOk = false;--%>
        <%--            }--%>
        <%--        }--%>
        <%--    });--%>
        <%--    if(!isOk){--%>
        <%--        return;--%>
        <%--    }--%>
        <%--    //浙商校验四要素是否验证通过--%>
        <%--    if(selectedRows[0].insCode=='czbank'){--%>
        <%--        $.ajax({--%>
        <%--            type: 'get',--%>
        <%--            dataType:'json',--%>
        <%--            async: false,--%>
        <%--            url: '<%=path%>/project/prjCstAccInfo/searchAccInfoByPrjId.do?prjId='+selectedRows[0].id,--%>
        <%--            success:function(data){--%>
        <%--                wait_dialog.close();--%>
        <%--                if(data.success != 1){--%>
        <%--                    $.ligerDialog.SQalert({content: data.info, SQ_type: "error",SQ_showButtons : true});--%>
        <%--                    isOk = false;--%>
        <%--                }--%>
        <%--            }--%>
        <%--        });--%>
        <%--    }--%>
        <%--    //判断是否验证通过--%>
        <%--    if(!isOk){--%>
        <%--       return;--%>
        <%--    }--%>

        <%--    $.ajax({--%>
	    <%--    	type: 'post',--%>
	    <%--		dataType:'json',--%>
	    <%--		url: '<%=path%>/project/audit/lnkCompAud.do?prjId='+prjId,--%>
	    <%--		success:function(data){--%>
	    <%--			if(data.success == 1){--%>
	    <%--				$.ajax({--%>
	    <%--		    		type: 'post',--%>
	    <%--		    		dataType:'json',--%>
	    <%--		    		url: '<%=path%>/project/audit/addFlowStart.do?prjId='+prjId+'&flowTypeKey='+flowTypeKey,--%>
	    <%--		    		success:function(msg){--%>
	    <%--		    			 wait_dialog.close();--%>
	    <%--		    			 if(msg.success == 1){//成功发起流程--%>
	    <%--		   					 UIUtils.alertSuccessHold1(msg.info);--%>
	    <%--		    				 grid.reload();--%>
	    <%--		    			 }else if(msg.success == 0){//错误--%>
	    <%--		   					 UIUtils.alertErrorHold1(msg.info);--%>
	    <%--		    			 }else if(msg.success ==2){//找到多个流程--%>
	    <%--		    				//TODO--%>
	    <%--		    				console.log(msg.data);--%>
	    <%--		    				var __DATA_radioList = msg.data;--%>
	    <%--							var selectedVal = '';--%>
	    <%--							var selectDialog = $.ligerDialog.SQopen({--%>
	    <%--								 width: 300,--%>
	    <%--								 height: 200,--%>
	    <%--								 title : '请选择要发起的流程',--%>
	    <%--								 allowClose: false,--%>
	    <%--								 content: '<div id="radiolist1"></div>',--%>
	    <%--								 fixButtons: true, //固定按钮到底部--%>
	    <%--								 onOk: function () {--%>
	    <%--								     console.log(selectDialog);--%>
	    <%--								     console.log(selectedVal);--%>
	    <%--								     if(StringUtils.isEmpty(selectedVal)){--%>
	    <%--								    	 $.ligerDialog.SQalert({content: "请选择要发起的流程.", SQ_type: "warning"});--%>
	    <%--								         return;--%>
	    <%--								     }else{--%>
	    <%--									    selectDialog.close();--%>
	    <%--								    	var wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting",onClose: function () {}});--%>
	    <%--			    	            		$.ajax({--%>
	    <%--			    	                		type: 'post',--%>
	    <%--			    	                		dataType:'json',--%>
	    <%--			    	                		url: '<%=path%>/project/audit/addFlowStart.do?prjId='+prjId+'&procDefKey='+selectedVal,--%>
	    <%--			    	                		success:function(msg){--%>
	    <%--			    	                			 wait_dialog.close();--%>
	    <%--			    	                			 if(msg.success == 1){//成功发起流程--%>
	    <%--			    	               					 UIUtils.alertSuccessHold1(msg.info);--%>
	    <%--			    	                				 grid.reload();--%>
	    <%--			    	                			 }else if(msg.success == 0){//错误--%>
	    <%--			    	               					 UIUtils.alertErrorHold1(msg.info);--%>
	    <%--			    	                			 }--%>
	    <%--			    	                		}--%>
	    <%--			    	            		})--%>
	    <%--								     }--%>
	    <%--								 }--%>
	    <%--							});--%>
	    <%--							$("#radiolist1").ligerRadioList({--%>
	    <%--							 data: __DATA_radioList,--%>
	    <%--							 textField: 'procNm',--%>
	    <%--							 valueField: 'procDefKey',--%>
	    <%--							 rowSize: 1,--%>
	    <%--							 onSelect: function (data)--%>
	    <%--							 {--%>
	    <%--							     console.log(data);--%>
	    <%--							     selectedVal = data.value;--%>
	    <%--							 }--%>
	    <%--							});--%>
	    <%--		    			 }--%>
	    <%--		    		}--%>
	    <%--		    	});--%>
	    <%--			}else{--%>
        <%--                wait_dialog.close();--%>
	    <%--				$.ligerDialog.SQalert({content: data.info, SQ_type: "warning"});--%>
		<%--		         return;--%>
	    <%--			}--%>
	    <%--		}--%>
	    <%--    });--%>
        <%--});--%>
	}

	function addFlowStartConfirm(selectedRows, flowTypeKey, startExpatriateFlow) {
        var prjId = selectedRows[0].id;
        // 在项目流程发起的同时，发起供应商账号、供应商返利账号、销售返利账号的流程（如果账号审核状态是未提交和未通过的前提下）huangkailun
        $.ajax({
            type: 'get',
            dataType:'json',
            async: false,
            url: '<%=path%>/project/prjbscinfo/queryAccStsAndGetFlowParams.do?prjId='+prjId,
            success:function(data){
                if(data.success == 1){
                    var splFLow = data.data.splFlow;
                    var splBackFlow = data.data.splBackFlow;
                    var saleRebAccFlow = data.data.saleRebAccFlow;
                    if (splFLow == 'spl') {
                        $.ajax({
                            type: 'post',
                            dataType:'json',
                            async: false,
                            data:{
                                id:data.data.splId,
                                procDefKey:data.data.splProcDefKey,
                                procDefId:data.data.splProcDefId,
                                procNo:data.data.splProcNo,
                                modelTyp:data.data.splModelTyp
                            },
                            url: '<%=path%>/commonBankAcc/flow/startAccessFlow.do',
                            success:function(data){

                            }
                        });
                    }
                    if (splBackFlow == 'splBack'){
                        $.ajax({
                            type: 'post',
                            dataType:'json',
                            async: false,
                            data:{
                                id:data.data.splBackId,
                                procDefKey:data.data.splBackProcDefKey,
                                procDefId:data.data.splBackProcDefId,
                                procNo:data.data.splBackProcNo,
                                modelTyp:data.data.splBackModelTyp
                            },
                            url: '<%=path%>/commonBankAcc/flow/startAccessFlow.do',
                            success:function(data){

                            }
                        });
                    }
                    if (saleRebAccFlow == 'saleRebAcc') {
                        $.ajax({
                            type: 'post',
                            dataType:'json',
                            async: false,
                            data:{
                                id:data.data.saleRebAccId,
                                procDefKey:data.data.saleRebAccProcDefKey,
                                procDefId:data.data.saleRebAccProcDefId,
                                procNo:data.data.saleRebAccProcNo,
                                modelTyp:data.data.saleRebAccModelTyp
                            },
                            url: '<%=path%>/commonBankAcc/flow/startAccessFlow.do',
                            success:function(data){

                            }
                        });
                    }

                }
            }
        });

        var wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting",onClose: function () {}});
        var isOk = true;//是否验证通过
        //验证客户风险状态
        <%--$.ajax({--%>
        <%--    type: 'get',--%>
        <%--    dataType:'json',--%>
        <%--    async: false,--%>
        <%--    &lt;%&ndash;url: '<%=path%>/risk/rskCstSignLog/searchRskSts.do?prjId='+selectedRows[0].id,&ndash;%&gt;--%>
        <%--    url: '<%=path%>/project/audit/checkRiskSign.do?flow=PRJ&prjId='+selectedRows[0].id,--%>
        <%--    success:function(data){--%>
        <%--        wait_dialog.close();--%>
        <%--        if(data.success != 1){--%>
        <%--            $.ligerDialog.SQalert({content: data.info, SQ_type: "error",SQ_showButtons : true});--%>
        <%--            isOk = false;--%>
        <%--        }--%>
        <%--    }--%>
        <%--});--%>
        if(!isOk){
            return;
        }
        //浙商校验四要素是否验证通过
        if(selectedRows[0].insCode=='czbank'){
            $.ajax({
                type: 'get',
                dataType:'json',
                async: false,
                url: '<%=path%>/project/prjCstAccInfo/searchAccInfoByPrjId.do?prjId='+selectedRows[0].id,
                success:function(data){
                    wait_dialog.close();
                    if(data.success != 1){
                        $.ligerDialog.SQalert({content: data.info, SQ_type: "error",SQ_showButtons : true});
                        isOk = false;
                    }
                }
            });
        }
        //判断是否验证通过
        if(!isOk){
            return;
        }

        $.ajax({
            type: 'post',
            dataType:'json',
            url: '<%=path%>/project/audit/lnkCompAud.do?prjId='+prjId,
            success:function(data){
                if(data.success == 1){
                    $.ajax({
                        type: 'post',
                        dataType:'json',
                        url: '<%=path%>/project/audit/addFlowStart.do?prjId='+prjId+'&flowTypeKey='+flowTypeKey+'&startExpatriateFlow='+startExpatriateFlow,
                        success:function(msg){
                            wait_dialog.close();
                            if(msg.success == 1){//成功发起流程
                                UIUtils.alertSuccessHold1(msg.info);
                                grid.reload();
                            }else if(msg.success == 0){//错误
                                UIUtils.alertErrorHold1(msg.info);
                            }else if(msg.success ==2){//找到多个流程
                                //TODO
                                console.log(msg.data);
                                var __DATA_radioList = msg.data;
                                var selectedVal = '';
                                var selectDialog = $.ligerDialog.SQopen({
                                    width: 300,
                                    height: 200,
                                    title : '请选择要发起的流程',
                                    allowClose: false,
                                    content: '<div id="radiolist1"></div>',
                                    fixButtons: true, //固定按钮到底部
                                    onOk: function () {
                                        console.log(selectDialog);
                                        console.log(selectedVal);
                                        if(StringUtils.isEmpty(selectedVal)){
                                            $.ligerDialog.SQalert({content: "请选择要发起的流程.", SQ_type: "warning"});
                                            return;
                                        }else{
                                            selectDialog.close();
                                            var wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting",onClose: function () {}});
                                            $.ajax({
                                                type: 'post',
                                                dataType:'json',
                                                url: '<%=path%>/project/audit/addFlowStart.do?prjId='+prjId+'&procDefKey='+selectedVal+'&startExpatriateFlow='+startExpatriateFlow,
                                                success:function(msg){
                                                    wait_dialog.close();
                                                    if(msg.success == 1){//成功发起流程
                                                        UIUtils.alertSuccessHold1(msg.info);
                                                        grid.reload();
                                                    }else if(msg.success == 0){//错误
                                                        UIUtils.alertErrorHold1(msg.info);
                                                    }
                                                }
                                            })
                                        }
                                    }
                                });
                                $("#radiolist1").ligerRadioList({
                                    data: __DATA_radioList,
                                    textField: 'procNm',
                                    valueField: 'procDefKey',
                                    rowSize: 1,
                                    onSelect: function (data)
                                    {
                                        console.log(data);
                                        selectedVal = data.value;
                                    }
                                });
                            }
                        }
                    });
                }else{
                    wait_dialog.close();
                    $.ligerDialog.SQalert({content: data.info, SQ_type: "warning"});
                    return;
                }
            }
        });
    }

	function changeMgr(){
		var callback = function(){
			 grid.reload();
		}
		var selectedRows = grid.getSelectedRows();
		if (selectedRows.length == 0) {
            $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_MORE_ROW, SQ_type: "warning"});
            return;
        }
		var ids = "";
		for ( var index in selectedRows) {
			ids = ids + selectedRows[index].id + ",";
		}
        $.ligerDialog.open({  title: '业务移交',height: 500,width: 850, url:'<%=path%>/project/prjbscinfo/changeMgr.do?ids='+ids,callback:callback});
	}
	
	//下载模板
    function downTemp(){
        window.location.href="<%=path%>/resource/template/ywchange/ywchange.xlsx";
    }
	
  //批量导入
    function addBatch(){
        //获取上传文件地址
        var files=getUploadResultParams();
        if(files&&files.length>0){
            var filePath=files[0].filePath;
            var fileExtension = filePath.substring(filePath.lastIndexOf('.') + 1);
            if(fileExtension!='xlsx'&&fileExtension!='XLSX'){
                $.ligerDialog.SQalert({content: "请上传.xlsx后缀的文件", SQ_type: "warn"});
                return;
            }
            var wait_dialog;
            $.ajax({
                type: 'post',
                dataType:'json',
                data:"filePath="+filePath,
                url: '<%=path%>/project/prjbscinfo/ywchange.do',
                beforeSend: function(){
                    wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
                },
                success:function(msg){
                    wait_dialog.close();
                    if(msg.success == 1){
                    	if(msg.data.length>0){
                    		showResult(msg.data);
                    	}else{
                    		$.ligerDialog.SQalert({content: "处理成功！",SQ_type: "success"});
                    		clearUploadResultParams();
                    	}
                    }else{
                        $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                    }
                }
            });
        }else{
            $.ligerDialog.SQalert({content: "请先上传文件", SQ_type: "warn"});
        }
    }
  
    function showResult(data){
		$.ligerDialog.SQopen({
            width: 400,
            top: 100,
            buttons: [
                {
                    text: "关闭", cls: 'l-dialog-btn-no', onclick:function(){
                    	$.ligerDialog.hide();
                    }
                }
            ],
            title : '业务移交结果',
            target: $("#ywchange_result")
        });
		$("#ywchange_result_form").ligerForm({
          	 validate: true
   		});
		$("#ywchange_result_form").html("");
		//填充数据(动态展示数据)
		for(var i=0;i<data.length;i++){
			var lsCntNo = data[i].lsCntNo;
			var usrNm = data[i].usrNm;
			var p = '<p><span>'+lsCntNo+'</span><span style="margin-left:100px">'+usrNm+'</span></p>';
			$("#ywchange_result_form").append(p);
		}
		clearUploadResultParams();
	}
	
	function updateInfo(id){
		var callback = function(){
			 grid.reload();
		} 
		var detailFlag = true;
		Add_navTab('tab_prj_prd_info_pro_change'+id,'账号变更','<%=path%>/project/prjbscinfo/toPrjPrdListPage.do?id='+id+'&detailFlag='+detailFlag+'&changeFlag=0',callback);
		//$.ligerDialog.open({  title: '供应商修改',height: 600,width: 850, url:'<%=path%>/project/prjbscinfo/toPrjPrdListPage.do?id='+id+'&detailFlag='+detailFlag+'&changeFlag=0',callback:callback});
        //$.ligerDialog.open({  title: '供应商修改',height: 200,width: 740, url:'<%=path%>/project/prjbscinfo/changePro.do?id='+id,callback:callback});
	}
	
	 //初始化查询条件中的下拉树
  /*var searchOrgTree = null;
    function initOrgTree(){
    	 searchOrgTree = $("#orgCd").ligerComboBox({
             selectBoxWidth: 240,
             selectBoxHeight: 150,
             treeLeafOnly: false, //限制只能选叶节点，父节点不能点击
             tree: {
                 ajaxType: 'get',
                 idFieldName:'text',
                 checkbox: false,
                 parentIcon: "none",
                 childIcon: "none"
             }
         });
    	 
    	 $.ajax({
     		type: 'get',
     		dataType:'json',
     		data: "",
     		url: '<%=path%>/system/sysOrg/searchOrgTree.do',
     		success:function(msg){
     			if(msg.success == 1){
     				searchOrgTree.treeManager.setData(msg.data);
     				searchOrgTree.clear();
     			}else{
     				 $.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
     			}
     		}
     	});
    	 
    }*/
  function clearBtn(){
    $("#searchBar").ligerForm();
			var form = new liger.get("searchBar");
			//form.clear(); 
			form.setData({
				prjNm:" ",
				cstNm:" ",
				prjTypCd:" ",
				bizTypCd:" ",
				prjStsCd:" ",
				orgCd:" ",
				lsCntNo:" ",
				cstMgrNm:"",
				cntTypCd:" ",
                isSplMfr:" "
			 });
	}
	function iframeResize () {
	    if (parent.mainApp) {
	        parent.mainApp.parentTab.onResize();
	    }
	}
	
		function getscore(prjId){
        //弹出框校验供应商是否已存在
        $.ligerDialog.SQopen({
            width: 1000,
            height:480,
            title : '',
            url:'<%=path%>/system/sysscorerec/toGetPrjScore.do?id='+prjId,

        });
	}
	function addPrjLnkCompCrLim(lnkCompId){
		var lnkCompId='${lnkCompId}';
	    $.ligerDialog.open({title: '添加挂靠公司敞口信息',height: 400,width: 900, url: '<%=path%>/project/prjlnkcomp/toAddPrjLnkCompCrLimPage.do?lnkCompId='+lnkCompId,
	    	   buttons: [{
	                text: "保存", onclick: onSave, type: 'ok', cls: 'l-dialog-btn-ok'
	            },
	            {
	                text: "取消", onclick: onCancel, type: 'cancel', cls: 'l-dialog-btn-no'
	            }
	        ]
	    });
	}
		
	var onSave = function (item, Dialog) {
		 //在子页面里绑定 frameElement.dialog.onOk = function () {}
			if (Dialog.onSave) Dialog.onSave();
		};

		var onCancel = function (item, Dialog) {
			 //在子页面里绑定 frameElement.dialog.onOk = function () {}
				if (Dialog.onCancel) Dialog.onCancel();
		};

	function taskTransferBtn(){
		
       $.ligerDialog.open({  title: '任务交接',height: 600,width: 1000, url:'<%=path%>/project/prjbscinfo/taskTransfer.do'});
	}	

	//判断该客户是否存在状态为"审核中"的《客户主要信息变更流程》-BUG-5717
	function checkCstModFlow(_cstId){
		var cFlag = 0;
		var params = {cstId:_cstId};
		var _url = '<%=path%>/customer/cstbscinfo/checkCstModFlow.do';
		$.ajax({
    		type:'get',
    		dataType:'json',
    		async:false,
    		url:_url,
    		data:params,
    		success:function(msg){
    			if(msg.success == 1){//存在-不支持立项和评审
					cFlag = 1;
					UIUtils.alertWarning(msg.info);
				}else if(msg.success == 0){//不存在-可以立项和评审
					cFlag = 0;
				}
    		},
    		error:function(msg){
    			UIUtils.alertError(msg.info);
    		}
    	});
		return cFlag;
	}
</script>

</body>
</html>